﻿' Copyright (c) 2016  Veloxcore.com
'  All rights reserved.
' 
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
' DEALINGS IN THE SOFTWARE.
' 

Imports DotNetNuke
Imports CustomDNN.Modules.Thumbnail.Components

Namespace Data

    ''' <summary>
    ''' An abstract class for the data access layer
    ''' 
    ''' The abstract data provider provides the methods that a control data provider (sqldataprovider)
    ''' must implement. You'll find two commented out examples in the Abstract methods region below.
    ''' </summary>

    Public MustInherit Class DataProvider

#Region "Shared/Static Methods"

        ' singleton reference to the instantiated object 
        Private Shared objProvider As DataProvider = Nothing

        ' constructor
        Shared Sub New()
            CreateProvider()
        End Sub

        ' dynamically create provider
        Private Shared Sub CreateProvider()
            objProvider = CType(Framework.Reflection.CreateObject("data", "CustomDNN.Modules.Thumbnail.Data", ""), DataProvider)
        End Sub

        ' return the provider
        Public Shared Shadows Function Instance() As DataProvider
            Return objProvider
        End Function

#End Region

#Region "Abstract methods"
        'public MustOverride function GetItems(ByVal moduleId as Integer) as IDataReader 
        'public MustOverride function GetItem(ByVal itemid as Integer) as IDataReader 

        Public MustOverride Function GetThumbnails(ByVal moduleID As Integer) As IDataReader

        Public MustOverride Function GetThumbnail(ByVal ID As Integer) As IDataReader

        Public MustOverride Function AddThumbnail(thumbnail As ThumbnailEntity) As Integer

        Public MustOverride Sub DeleteThumbnail(ID As Integer)

        Public MustOverride Sub DeleteThumbnails(ByVal moduleID As Integer)

        Public MustOverride Sub UpdateThumbnail(thumbnail As ThumbnailEntity)

#End Region

    End Class

End Namespace